home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / ASSEMBLE / H145.ZIP / ASXXXX_4.ZIP / TZ80.ASM < prev    next >
Assembly Source File  |  1990-07-18  |  27KB  |  1,014 lines

  1.     .title    Test of Z80 / HD64180 assembler
  2.  
  3.     offset    =    0x55        ;arbitrary constants
  4.     n    =    0x20
  5.     nn    =    0x0584
  6.  
  7.     ; notes:
  8.     ;    Leading 'a' operand is optional.
  9.     ;    If offset is ommitted 0 is assumed.
  10.  
  11.     ;***********************************************************
  12.     ;add with carry to 'a'
  13.     adc    a,(hl)            ; 8E
  14.     adc    a,offset(ix)        ; DD 8E 55
  15.     adc    a,offset(iy)        ; FD 8E 55
  16.     adc    a,a            ; 8F
  17.     adc    a,b            ; 88
  18.     adc    a,c            ; 89
  19.     adc    a,d            ; 8A
  20.     adc    a,e            ; 8B
  21.     adc    a,h            ; 8C
  22.     adc    a,l            ; 8D
  23.     adc    a,#n            ; CE 20
  24.     ;***********************************************************
  25.     adc    (hl)            ; 8E
  26.     adc    offset(ix)        ; DD 8E 55
  27.     adc    offset(iy)        ; FD 8E 55
  28.     adc    a            ; 8F
  29.     adc    b            ; 88
  30.     adc    c            ; 89
  31.     adc    d            ; 8A
  32.     adc    e            ; 8B
  33.     adc    h            ; 8C
  34.     adc    l            ; 8D
  35.     adc    #n            ; CE 20
  36.     ;***********************************************************
  37.     ;add with carry register pair to 'hl'
  38.     adc    hl,bc            ; ED 4A
  39.     adc    hl,de            ; ED 5A
  40.     adc    hl,hl            ; ED 6A
  41.     adc    hl,sp            ; ED 7A
  42.     ;***********************************************************
  43.     ;add operand to 'a'
  44.     add    a,(hl)            ; 86
  45.     add    a,offset(ix)        ; DD 86 55
  46.     add    a,offset(iy)        ; FD 86 55
  47.     add    a,a            ; 87
  48.     add    a,b            ; 80
  49.     add    a,c            ; 81
  50.     add    a,d            ; 82
  51.     add    a,e            ; 83
  52.     add    a,h            ; 84
  53.     add    a,l            ; 85
  54.     add    a,#n            ; C6 20
  55.     ;***********************************************************
  56.     ;add register pair to 'hl'
  57.     add    hl,bc            ; 09
  58.     add    hl,de            ; 19
  59.     add    hl,hl            ; 29
  60.     add    hl,sp            ; 39
  61.     ;***********************************************************
  62.     ;add register pair to 'ix'
  63.     add    ix,bc            ; DD 09
  64.     add    ix,de            ; DD 19
  65.     add    ix,ix            ; DD 29
  66.     add    ix,sp            ; DD 39
  67.     ;***********************************************************
  68.     ;add register pair to 'iy'
  69.     add    iy,bc            ; FD 09
  70.     add    iy,de            ; FD 19
  71.     add    iy,iy            ; FD 29
  72.     add    iy,sp            ; FD 39
  73.     ;***********************************************************
  74.     ;logical 'and' operand with 'a'
  75.     and    a,(hl)            ; A6
  76.     and    a,offset(ix)        ; DD A6 55
  77.     and    a,offset(iy)        ; FD A6 55
  78.     and    a,a            ; A7
  79.     and    a,b            ; A0
  80.     and    a,c            ; A1
  81.     and    a,d            ; A2
  82.     and    a,e            ; A3
  83.     and    a,h            ; A4
  84.     and    a,l            ; A5
  85.     and    a,#n            ; E6 20
  86.     ;***********************************************************
  87.     ;test bit of location or register
  88.     bit    0,(hl)            ; CB 46
  89.     bit    0,offset(ix)        ; DD CB 55 46
  90.     bit    0,offset(iy)        ; FD CB 55 46
  91.     bit    0,a            ; CB 47
  92.     bit    0,b            ; CB 40
  93.     bit    0,c            ; CB 41
  94.     bit    0,d            ; CB 42
  95.     bit    0,e            ; CB 43
  96.     bit    0,h            ; CB 44
  97.     bit    0,l            ; CB 45
  98.     bit    1,(hl)            ; CB 4E
  99.     bit    1,offset(ix)        ; DD CB 55 4E
  100.     bit    1,offset(iy)        ; FD CB 55 4E
  101.     bit    1,a            ; CB 4F
  102.     bit    1,b            ; CB 48
  103.     bit    1,c            ; CB 49
  104.     bit    1,d            ; CB 4A
  105.     bit    1,e            ; CB 4B
  106.     bit    1,h            ; CB 4C
  107.     bit    1,l            ; CB 4D
  108.     bit    2,(hl)            ; CB 56
  109.     bit    2,offset(ix)        ; DD CB 55 56
  110.     bit    2,offset(iy)        ; FD CB 55 56
  111.     bit    2,a            ; CB 57
  112.     bit    2,b            ; CB 50
  113.     bit    2,c            ; CB 51
  114.     bit    2,d            ; CB 52
  115.     bit    2,e            ; CB 53
  116.     bit    2,h            ; CB 54
  117.     bit    2,l            ; CB 55
  118.     bit    3,(hl)            ; CB 5E
  119.     bit    3,offset(ix)        ; DD CB 55 5E
  120.     bit    3,offset(iy)        ; FD CB 55 5E
  121.     bit    3,a            ; CB 5F
  122.     bit    3,b            ; CB 58
  123.     bit    3,c            ; CB 59
  124.     bit    3,d            ; CB 5A
  125.     bit    3,e            ; CB 5B
  126.     bit    3,h            ; CB 5C
  127.     bit    3,l            ; CB 5D
  128.     bit    4,(hl)            ; CB 66
  129.     bit    4,offset(ix)        ; DD CB 55 66
  130.     bit    4,offset(iy)        ; FD CB 55 66
  131.     bit    4,a            ; CB 67
  132.     bit    4,b            ; CB 60
  133.     bit    4,c            ; CB 61
  134.     bit    4,d            ; CB 62
  135.     bit    4,e            ; CB 63
  136.     bit    4,h            ; CB 64
  137.     bit    4,l            ; CB 65
  138.     bit    5,(hl)            ; CB 6E
  139.     bit    5,offset(ix)        ; DD CB 55 6E
  140.     bit    5,offset(iy)        ; FD CB 55 6E
  141.     bit    5,a            ; CB 6F
  142.     bit    5,b            ; CB 68
  143.     bit    5,c            ; CB 69
  144.     bit    5,d            ; CB 6A
  145.     bit    5,e            ; CB 6B
  146.     bit    5,h            ; CB 6C
  147.     bit    5,l            ; CB 6D
  148.     bit    6,(hl)            ; CB 76
  149.     bit    6,offset(ix)        ; DD CB 55 76
  150.     bit    6,offset(iy)        ; FD CB 55 76
  151.     bit    6,a            ; CB 77
  152.     bit    6,b            ; CB 70
  153.     bit    6,c            ; CB 71
  154.     bit    6,d            ; CB 72
  155.     bit    6,e            ; CB 73
  156.     bit    6,h            ; CB 74
  157.     bit    6,l            ; CB 75
  158.     bit    7,(hl)            ; CB 7E
  159.     bit    7,offset(ix)        ; DD CB 55 7E
  160.     bit    7,offset(iy)        ; FD CB 55 7E
  161.     bit    7,a            ; CB 7F
  162.     bit    7,b            ; CB 78
  163.     bit    7,c            ; CB 79
  164.     bit    7,d            ; CB 7A
  165.     bit    7,e            ; CB 7B
  166.     bit    7,h            ; CB 7C
  167.     bit    7,l            ; CB 7D
  168.     ;***********************************************************
  169.     ;call subroutine at nn if condition is true
  170.     call    C,nn            ; DC 84 05
  171.     call    M,nn            ; FC 84 05
  172.     call    NC,nn            ; D4 84 05
  173.     call    NZ,nn            ; C4 84 05
  174.     call    P,nn            ; F4 84 05
  175.     call    PE,nn            ; EC 84 05
  176.     call    PO,nn            ; E4 84 05
  177.     call    Z,nn            ; CC 84 05
  178.     ;***********************************************************
  179.     ;unconditional call to subroutine at nn
  180.     call    nn            ; CD 84 05
  181.     ;***********************************************************
  182.     ;complement carry flag
  183.     ccf                ; 3F
  184.     ;***********************************************************
  185.     ;compare operand with 'a'
  186.     cp    a,(hl)            ; BE
  187.     cp    a,offset(ix)        ; DD BE 55
  188.     cp    a,offset(iy)        ; FD BE 55
  189.     cp    a,a            ; BF
  190.     cp    a,b            ; B8
  191.     cp    a,c            ; B9
  192.     cp    a,d            ; BA
  193.     cp    a,e            ; BB
  194.     cp    a,h            ; BC
  195.     cp    a,l            ; BD
  196.     cp    a,#n            ; FE 20
  197.     ;***********************************************************
  198.     ;compare location (hl) and 'a'
  199.     ;decrement 'hl' and 'bc'
  200.     cpd                ; ED A9
  201.     ;***********************************************************
  202.     ;compare location (hl) and 'a'
  203.     ;decrement 'hl' and 'bc'
  204.     ;repeat until 'bc' = 0
  205.     cpdr                ; ED B9
  206.     ;***********************************************************
  207.     ;compare location (hl) and 'a'
  208.     ;increment 'hl' and decrement 'bc'
  209.     cpi                ; ED A1
  210.     ;***********************************************************
  211.     ;compare location (hl) and 'a'
  212.     ;increment 'hl' and decrement 'bc'
  213.     ;repeat until 'bc' = 0
  214.     cpir                ; ED B1
  215.     ;***********************************************************
  216.     ;1's complement of 'a'
  217.     cpl                ; 2F
  218.     ;***********************************************************
  219.     ;decimal adjust 'a'
  220.     daa                ; 27
  221.     ;***********************************************************
  222.     ;decrement operand
  223.     dec    (hl)            ; 35
  224.     dec    offset(ix)        ; DD 35 55
  225.     dec    offset(iy)        ; FD 35 55
  226.     dec    a            ; 3D
  227.     dec    b            ; 05
  228.     dec    bc            ; 0B
  229.     dec    c            ; 0D
  230.     dec    d            ; 15
  231.     dec    de            ; 1B
  232.     dec    e            ; 1D
  233.     dec    h            ; 25
  234.     dec    hl            ; 2B
  235.     dec    ix            ; DD 2B
  236.     dec    iy            ; FD 2B
  237.     dec    l            ; 2D
  238.     dec    sp            ; 3B
  239.     ;***********************************************************
  240.     ;disable interrupts
  241.     di                ; F3
  242.     ;***********************************************************
  243.     ;decrement b and jump relative if b # 0
  244.     djnz    .+0x12            ; 10 10
  245.     ;***********************************************************
  246.     ;enable interrupts
  247.     ei                ; FB
  248.     ;***********************************************************
  249.     ;exchange location and (sp)
  250.     ex    (sp),hl            ; E3
  251.     ex    (sp),ix            ; DD E3
  252.     ex    (sp),iy            ; FD E3
  253.     ;***********************************************************
  254.     ;exchange af and af'
  255.     ex    af,af'            ; 08
  256.     ;***********************************************************
  257.     ;exchange de and hl
  258.     ex    de,hl            ; EB
  259.     ;***********************************************************
  260.     ;exchange:
  261.     ;    bc <-> bc'
  262.     ;    de <-> de'
  263.     ;    hl <-> hl'
  264.     exx                ; D9
  265.     ;***********************************************************
  266.     ;halt (wait for interrupt or reset)
  267.     halt                ; 76
  268.     ;***********************************************************
  269.     ;set interrupt mode
  270.     im    0            ; ED 46
  271.     im    1            ; ED 56
  272.     im    2            ; ED 5E
  273.     ;***********************************************************
  274.     ;load 'a' with input from device n
  275.     in    a,(n)            ; DB 20
  276.     ;***********************************************************
  277.     ;load register with input from (c)
  278.     in    a,(c)            ; ED 78
  279.     in    b,(c)            ; ED 40
  280.     in    c,(c)            ; ED 48
  281.     in    d,(c)            ; ED 50
  282.     in    e,(c)            ; ED 58
  283.     in    h,(c)            ; ED 60
  284.     in    l,(c)            ; ED 68
  285.     ;***********************************************************
  286.     ;increment operand
  287.     inc    (hl)            ; 34
  288.     inc    offset(ix)        ; DD 34 55
  289.     inc    offset(iy)        ; FD 34 55
  290.     inc    a            ; 3C
  291.     inc    b            ; 04
  292.     inc    bc            ; 03
  293.     inc    c            ; 0C
  294.     inc    d            ; 14
  295.     inc    de            ; 13
  296.     inc    e            ; 1C
  297.     inc    h            ; 24
  298.     inc    hl            ; 23
  299.     inc    ix            ; DD 23
  300.     inc    iy            ; FD 23
  301.     inc    l            ; 2C
  302.     inc    sp            ; 33
  303.     ;***********************************************************
  304.     ;load location (hl) with input
  305.     ;from port (c)
  306.     ;decrement 'hl' and 'b'
  307.     ind                ; ED AA
  308.     ;***********************************************************
  309.     ;load location (hl) with input
  310.     ;from port (c)
  311.     ;decrement 'hl' and 'b'
  312.     ;repeat until 'b' = 0
  313.     indr                ; ED BA
  314.     ;***********************************************************
  315.     ;load location (hl) with input
  316.     ;from port (c)
  317.     ;increment 'hl' and decrement 'b'
  318.     ini                ; ED A2
  319.     ;***********************************************************
  320.     ;load location (hl) with input
  321.     ;from port (c)
  322.     ;increment 'hl' and decrement 'b'
  323.     ;repeat until 'b' = 0
  324.     inir                ; ED B2
  325.     ;***********************************************************
  326.     ;unconditional jump to location nn
  327.     jp    nn            ; C3 84 05
  328.     jp    (hl)            ; E9
  329.     jp    (ix)            ; DD E9
  330.     jp    (iy)            ; FD E9
  331.     ;***********************************************************
  332.     ;jump to location if condition is true
  333.     jp    C,nn            ; DA 84 05
  334.     jp    M,nn            ; FA 84 05
  335.     jp    NC,nn            ; D2 84 05
  336.     jp    NZ,nn            ; C2 84 05
  337.     jp    P,nn            ; F2 84 05
  338.     jp    PE,nn            ; EA 84 05
  339.     jp    PO,nn            ; E2 84 05
  340.     jp    Z,nn            ; CA 84 05
  341.     ;***********************************************************
  342.     ;unconditional jump relative to PC+e
  343.     jr    jr1+0x10        ; 18 10
  344.     ;***********************************************************
  345.     ;jump relative to PC+e if condition is true
  346. jr1:    jr    C,jr2+0x10        ; 38 10
  347. jr2:    jr    NC,jr3+0x10        ; 30 10
  348. jr3:    jr    NZ,jr4+0x10        ; 20 10
  349. jr4:    jr    Z,jr5+0x10        ; 28 10
  350. jr5:
  351.     ;***********************************************************
  352.     ;load source to destination
  353.     ld    a,(hl)            ; 7E
  354.     ld    a,offset(ix)        ; DD 7E 55
  355.     ld    a,offset(iy)        ; FD 7E 55
  356.     ld    a,a            ; 7F
  357.     ld    a,b            ; 78
  358.     ld    a,c            ; 79
  359.     ld    a,d            ; 7A
  360.     ld    a,e            ; 7B
  361.     ld    a,h            ; 7C
  362.     ld    a,l            ; 7D
  363.     ld    a,#n            ; 3E 20
  364.     ld    b,(hl)            ; 46
  365.     ld    b,offset(ix)        ; DD 46 55
  366.     ld    b,offset(iy)        ; FD 46 55
  367.     ld    b,a            ; 47
  368.     ld    b,b            ; 40
  369.     ld    b,c            ; 41
  370.     ld    b,d            ; 42
  371.     ld    b,e            ; 43
  372.     ld    b,h            ; 44
  373.     ld    b,l            ; 45
  374.     ld    b,#n            ; 06 20
  375.     ld    c,(hl)            ; 4E
  376.     ld    c,offset(ix)        ; DD 4E 55
  377.     ld    c,offset(iy)        ; FD 4E 55
  378.     ld    c,a            ; 4F
  379.     ld    c,b            ; 48
  380.     ld    c,c            ; 49
  381.     ld    c,d            ; 4A
  382.     ld    c,e            ; 4B
  383.     ld    c,h            ; 4C
  384.     ld    c,l            ; 4D
  385.     ld    c,#n            ; 0E 20
  386.     ld    d,(hl)            ; 56
  387.     ld    d,offset(ix)        ; DD 56 55
  388.     ld    d,offset(iy)        ; FD 56 55
  389.     ld    d,a            ; 57
  390.     ld    d,b            ; 50
  391.     ld    d,c            ; 51
  392.     ld    d,d            ; 52
  393.     ld    d,e            ; 53
  394.     ld    d,h            ; 54
  395.     ld    d,l            ; 55
  396.     ld    d,#n            ; 16 20
  397.     ld    e,(hl)            ; 5E
  398.     ld    e,offset(ix)        ; DD 5E 55
  399.     ld    e,offset(iy)        ; FD 5E 55
  400.     ld    e,a            ; 5F
  401.     ld    e,b            ; 58
  402.     ld    e,c            ; 59
  403.     ld    e,d            ; 5A
  404.     ld    e,e            ; 5B
  405.     ld    e,h            ; 5C
  406.     ld    e,l            ; 5D
  407.     ld    e,#n            ; 1E 20
  408.     ld    h,(hl)            ; 66
  409.     ld    h,offset(ix)        ; DD 66 55
  410.     ld    h,offset(iy)        ; FD 66 55
  411.     ld    h,a            ; 67
  412.     ld    h,b            ; 60
  413.     ld    h,c            ; 61
  414.     ld    h,d            ; 62
  415.     ld    h,e            ; 63
  416.     ld    h,h            ; 64
  417.     ld    h,l            ; 65
  418.     ld    h,#n            ; 26 20
  419.     ld    l,(hl)            ; 6E
  420.     ld    l,offset(ix)        ; DD 6E 55
  421.     ld    l,offset(iy)        ; FD 6E 55
  422.     ld    l,a            ; 6F
  423.     ld    l,b            ; 68
  424.     ld    l,c            ; 69
  425.     ld    l,d            ; 6A
  426.     ld    l,e            ; 6B
  427.     ld    l,h            ; 6C
  428.     ld    l,l            ; 6D
  429.     ld    l,#n            ; 2E 20
  430.     ;***********************************************************
  431.     ld    i,a            ; ED 47
  432.     ld    r,a            ; ED 4F
  433.     ld    a,i            ; ED 57
  434.     ld    a,r            ; ED 5F
  435.     ;***********************************************************
  436.     ld    (bc),a            ; 02
  437.     ld    (de),a            ; 12
  438.     ld    a,(bc)            ; 0A
  439.     ld    a,(de)            ; 1A
  440.     ;***********************************************************
  441.     ld    (hl),a            ; 77
  442.     ld    (hl),b            ; 70
  443.     ld    (hl),c            ; 71
  444.     ld    (hl),d            ; 72
  445.     ld    (hl),e            ; 73
  446.     ld    (hl),h            ; 74
  447.     ld    (hl),l            ; 75
  448.     ld    (hl),#n            ; 36 20
  449.     ;***********************************************************
  450.     ld    offset(ix),a        ; DD 77 55
  451.     ld    offset(ix),b        ; DD 70 55
  452.     ld    offset(ix),c        ; DD 71 55
  453.     ld    offset(ix),d        ; DD 72 55
  454.     ld    offset(ix),e        ; DD 73 55
  455.     ld    offset(ix),h        ; DD 74 55
  456.     ld    offset(ix),l        ; DD 75 55
  457.     ld    offset(ix),#n        ; DD 36 55 20
  458.     ;***********************************************************
  459.     ld    offset(iy),a        ; FD 77 55
  460.     ld    offset(iy),b        ; FD 70 55
  461.     ld    offset(iy),c        ; FD 71 55
  462.     ld    offset(iy),d        ; FD 72 55
  463.     ld    offset(iy),e        ; FD 73 55
  464.     ld    offset(iy),h        ; FD 74 55
  465.     ld    offset(iy),l        ; FD 75 55
  466.     ld    offset(iy),#n        ; FD 36 55 20
  467.     ;***********************************************************
  468.     ld    (nn),a            ; 32 84 05
  469.     ld    (nn),bc            ; ED 43 84 05
  470.     ld    (nn),de            ; ED 53 84 05
  471.     ld    (nn),hl            ; 22 84 05
  472.     ld    (nn),sp            ; ED 73 84 05
  473.     ld    (nn),ix            ; DD 22 84 05
  474.     ld    (nn),iy            ; FD 22 84 05
  475.     ;***********************************************************
  476.     ld    a,(nn)            ; 3A 84 05
  477.     ld    bc,(nn)            ; ED 4B 84 05
  478.     ld    de,(nn)            ; ED 5B 84 05
  479.     ld    hl,(nn)            ; 2A 84 05
  480.     ld    sp,(nn)            ; ED 7B 84 05
  481.     ld    ix,(nn)            ; DD 2A 84 05
  482.     ld    iy,(nn)            ; FD 2A 84 05
  483.     ;***********************************************************
  484.     ld    bc,#nn            ; 01 84 05
  485.     ld    de,#nn            ; 11 84 05
  486.     ld    hl,#nn            ; 21 84 05
  487.     ld    sp,#nn            ; 31 84 05
  488.     ld    ix,#nn            ; DD 21 84 05
  489.     ld    iy,#nn            ; FD 21 84 05
  490.     ;***********************************************************
  491.     ld    sp,hl            ; F9
  492.     ld    sp,ix            ; DD F9
  493.     ld    sp,iy            ; FD F9
  494.     ;***********************************************************
  495.     ;load location (hl)
  496.     ;with location (de)
  497.     ;decrement de, hl
  498.     ;decrement bc
  499.     ldd                ; ED A8
  500.     ;***********************************************************
  501.     ;load location (hl)
  502.     ;with location (de)
  503.     ;decrement de, hl
  504.     ;decrement bc
  505.     ;repeat until bc = 0
  506.     lddr                ; ED B8
  507.     ;***********************************************************
  508.     ;load location (hl)
  509.     ;with location (de)
  510.     ;increment de, hl
  511.     ;decrement bc
  512.     ldi                ; ED A0
  513.     ;***********************************************************
  514.     ;load location (hl)
  515.     ;with location (de)
  516.     ;increment de, hl
  517.     ;decrement bc
  518.     ;repeat until bc = 0
  519.     ldir                ; ED B0
  520.     ;***********************************************************
  521.     ;2's complement of 'a'
  522.     neg                ; ED 44
  523.     ;***********************************************************
  524.     ;no operation
  525.     nop                ; 00
  526.     ;***********************************************************
  527.     ;logical 'or' operand with 'a'
  528.     or    a,(hl)            ; B6
  529.     or    a,offset(ix)        ; DD B6 55
  530.     or    a,offset(iy)        ; FD B6 55
  531.     or    a,a            ; B7
  532.     or    a,b            ; B0
  533.     or    a,c            ; B1
  534.     or    a,d            ; B2
  535.     or    a,e            ; B3
  536.     or    a,h            ; B4
  537.     or    a,l            ; B5
  538.     or    a,#n            ; F6 20
  539.     ;***********************************************************
  540.     ;load output port (c)
  541.     ;with location (hl)
  542.     ;decrement hl and decrement b
  543.     ;repeat until b = 0
  544.     otdr                ; ED BB
  545.     ;***********************************************************
  546.     ;load output port (c)
  547.     ;with location (hl)
  548.     ;increment hl and decrement b
  549.     ;repeat until b = 0
  550.     otir                ; ED B3
  551.     ;***********************************************************
  552.     ;load output port (c) with reg
  553.     out    (c),a            ; ED 79
  554.     out    (c),b            ; ED 41
  555.     out    (c),c            ; ED 49
  556.     out    (c),d            ; ED 51
  557.     out    (c),e            ; ED 59
  558.     out    (c),h            ; ED 61
  559.     out    (c),l            ; ED 69
  560.     ;***********************************************************
  561.     ;load output port (n) with 'a'
  562.     out    (n),a            ; D3 20
  563.     ;***********************************************************
  564.     ;load output port (c)
  565.     ;with location (hl)
  566.     ;decrement hl and decrement b
  567.     outd                ; ED AB
  568.     ;***********************************************************
  569.     ;load output port (c)
  570.     ;with location (hl)
  571.     ;increment hl and decrement b
  572.     outi                ; ED A3
  573.     ;***********************************************************
  574.     ;load destination with top of stack
  575.     pop    af            ; F1
  576.     pop    bc            ; C1
  577.     pop    de            ; D1
  578.     pop    hl            ; E1
  579.     pop    ix            ; DD E1
  580.     pop    iy            ; FD E1
  581.     ;***********************************************************
  582.     ;put source on stack
  583.     push    af            ; F5
  584.     push    bc            ; C5
  585.     push    de            ; D5
  586.     push    hl            ; E5
  587.     push    ix            ; DD F5
  588.     push    iy            ; FD F5
  589.     ;***********************************************************
  590.     ;reset bit of location or register
  591.     res    0,(hl)            ; CB 86
  592.     res    0,offset(ix)        ; DD CB 55 86
  593.     res    0,offset(iy)        ; FD CB 55 86
  594.     res    0,a            ; CB 87
  595.     res    0,b            ; CB 80
  596.     res    0,c            ; CB 81
  597.     res    0,d            ; CB 82
  598.     res    0,e            ; CB 83
  599.     res    0,h            ; CB 84
  600.     res    0,l            ; CB 85
  601.     res    1,(hl)            ; CB 8E
  602.     res    1,offset(ix)        ; DD CB 55 8E
  603.     res    1,offset(iy)        ; FD CB 55 8E
  604.     res    1,a            ; CB 8F
  605.     res    1,b            ; CB 88
  606.     res    1,c            ; CB 89
  607.     res    1,d            ; CB 8A
  608.     res    1,e            ; CB 8B
  609.     res    1,h            ; CB 8C
  610.     res    1,l            ; CB 8D
  611.     res    2,(hl)            ; CB 96
  612.     res    2,offset(ix)        ; DD CB 55 96
  613.     res    2,offset(iy)        ; FD CB 55 96
  614.     res    2,a            ; CB 97
  615.     res    2,b            ; CB 90
  616.     res    2,c            ; CB 91
  617.     res    2,d            ; CB 92
  618.     res    2,e            ; CB 93
  619.     res    2,h            ; CB 94
  620.     res    2,l            ; CB 95
  621.     res    3,(hl)            ; CB 9E
  622.     res    3,offset(ix)        ; DD CB 55 9E
  623.     res    3,offset(iy)        ; FD CB 55 9E
  624.     res    3,a            ; CB 9F
  625.     res    3,b            ; CB 98
  626.     res    3,c            ; CB 99
  627.     res    3,d            ; CB 9A
  628.     res    3,e            ; CB 9B
  629.     res    3,h            ; CB 9C
  630.     res    3,l            ; CB 9D
  631.     res    4,(hl)            ; CB A6
  632.     res    4,offset(ix)        ; DD CB 55 A6
  633.     res    4,offset(iy)        ; FD CB 55 A6
  634.     res    4,a            ; CB A7
  635.     res    4,b            ; CB A0
  636.     res    4,c            ; CB A1
  637.     res    4,d            ; CB A2
  638.     res    4,e            ; CB A3
  639.     res    4,h            ; CB A4
  640.     res    4,l            ; CB A5
  641.     res    5,(hl)            ; CB AE
  642.     res    5,offset(ix)        ; DD CB 55 AE
  643.     res    5,offset(iy)        ; FD CB 55 AE
  644.     res    5,a            ; CB AF
  645.     res    5,b            ; CB A8
  646.     res    5,c            ; CB A9
  647.     res    5,d            ; CB AA
  648.     res    5,e            ; CB AB
  649.     res    5,h            ; CB AC
  650.     res    5,l            ; CB AD
  651.     res    6,(hl)            ; CB B6
  652.     res    6,offset(ix)        ; DD CB 55 B6
  653.     res    6,offset(iy)        ; FD CB 55 B6
  654.     res    6,a            ; CB B7
  655.     res    6,b            ; CB B0
  656.     res    6,c            ; CB B1
  657.     res    6,d            ; CB B2
  658.     res    6,e            ; CB B3
  659.     res    6,h            ; CB B4
  660.     res    6,l            ; CB B5
  661.     res    7,(hl)            ; CB BE
  662.     res    7,offset(ix)        ; DD CB 55 BE
  663.     res    7,offset(iy)        ; FD CB 55 BE
  664.     res    7,a            ; CB BF
  665.     res    7,b            ; CB B8
  666.     res    7,c            ; CB B9
  667.     res    7,d            ; CB BA
  668.     res    7,e            ; CB BB
  669.     res    7,h            ; CB BC
  670.     res    7,l            ; CB BD
  671.     ;***********************************************************
  672.     ;return from subroutine
  673.     ret                ; C9
  674.     ;***********************************************************
  675.     ;return from subroutine if condition is true
  676.     ret    C            ; D8
  677.     ret    M            ; F8
  678.     ret    NC            ; D0
  679.     ret    NZ            ; C0
  680.     ret    P            ; F0
  681.     ret    PE            ; E8
  682.     ret    PO            ; E0
  683.     ret    Z            ; C8
  684.     ;***********************************************************
  685.     ;return from interrupt
  686.     reti                ; ED 4D
  687.     ;***********************************************************
  688.     ;return from non-maskable interrupt
  689.     retn                ; ED 45
  690.     ;***********************************************************
  691.     ;rotate left through carry
  692.     rl    a,(hl)            ; CB 16
  693.     rl    a,offset(ix)        ; DD CB 55 16
  694.     rl    a,offset(iy)        ; FD CB 55 16
  695.     rl    a,a            ; CB 17
  696.     rl    a,b            ; CB 10
  697.     rl    a,c            ; CB 11
  698.     rl    a,d            ; CB 12
  699.     rl    a,e            ; CB 13
  700.     rl    a,h            ; CB 14
  701.     rl    a,l            ; CB 15
  702.     ;***********************************************************
  703.     ;rotate left 'a' with carry
  704.     rla                ; 17
  705.     ;***********************************************************
  706.     ;rotate left circular
  707.     rlc    a,(hl)            ; CB 06
  708.     rlc    a,offset(ix)        ; DD CB 55 06
  709.     rlc    a,offset(iy)        ; FD CB 55 06
  710.     rlc    a,a            ; CB 07
  711.     rlc    a,b            ; CB 00
  712.     rlc    a,c            ; CB 01
  713.     rlc    a,d            ; CB 02
  714.     rlc    a,e            ; CB 03
  715.     rlc    a,h            ; CB 04
  716.     rlc    a,l            ; CB 05
  717.     ;***********************************************************
  718.     ;rotate left 'a' circular
  719.     rlca                ; 07
  720.     ;***********************************************************
  721.     ;rotate digit left and right
  722.     ;between 'a' and location (hl)
  723.     rld                ; ED 6F
  724.     ;***********************************************************
  725.     ;rotate right through carry
  726.     rr    a,(hl)            ; CB 1E
  727.     rr    a,offset(ix)        ; DD CB 55 1E
  728.     rr    a,offset(iy)        ; FD CB 55 1E
  729.     rr    a,a            ; CB 1F
  730.     rr    a,b            ; CB 18
  731.     rr    a,c            ; CB 19
  732.     rr    a,d            ; CB 1A
  733.     rr    a,e            ; CB 1B
  734.     rr    a,h            ; CB 1C
  735.     rr    a,l            ; CB 1D
  736.     ;***********************************************************
  737.     ;rotate 'a' right with carry
  738.     rra                ; 1F
  739.     ;***********************************************************
  740.     ;rotate right circular
  741.     rrc    a,(hl)            ; CB 0E
  742.     rrc    a,offset(ix)        ; DD CB 55 0E
  743.     rrc    a,offset(iy)        ; FD CB 55 0E
  744.     rrc    a,a            ; CB 0F
  745.     rrc    a,b            ; CB 08
  746.     rrc    a,c            ; CB 09
  747.     rrc    a,d            ; CB 0A
  748.     rrc    a,e            ; CB 0B
  749.     rrc    a,h            ; CB 0C
  750.     rrc    a,l            ; CB 0D
  751.     ;***********************************************************
  752.     ;rotate 'a' right circular
  753.     rrca                ; 0F
  754.     ;***********************************************************
  755.     ;rotate digit right and left
  756.     ;between 'a' and location (hl)
  757.     rrd                ; ED 67
  758.     ;***********************************************************
  759.     ;restart location
  760.     rst    0x00            ; C7
  761.     rst    0x08            ; CF
  762.     rst    0x10            ; D7
  763.     rst    0x18            ; DF
  764.     rst    0x20            ; E7
  765.     rst    0x28            ; EF
  766.     rst    0x30            ; F7
  767.     rst    0x38            ; FF
  768.     ;***********************************************************
  769.     ;subtract with carry to 'a'
  770.     sbc    a,(hl)            ; 9E
  771.     sbc    a,offset(ix)        ; DD 9E 55
  772.     sbc    a,offset(iy)        ; FD 9E 55
  773.     sbc    a,a            ; 9F
  774.     sbc    a,b            ; 98
  775.     sbc    a,c            ; 99
  776.     sbc    a,d            ; 9A
  777.     sbc    a,e            ; 9B
  778.     sbc    a,h            ; 9C
  779.     sbc    a,l            ; 9D
  780.     sbc    a,#n            ; DE 20
  781.     ;***********************************************************
  782.     ;add with carry register pair to 'hl'
  783.     sbc    hl,bc            ; ED 42
  784.     sbc    hl,de            ; ED 52
  785.     sbc    hl,hl            ; ED 62
  786.     sbc    hl,sp            ; ED 72
  787.     ;***********************************************************
  788.     ;set carry flag (C=1)
  789.     scf                ; 37
  790.     ;***********************************************************
  791.     ;set bit of location or register
  792.     set    0,(hl)            ; CB C6
  793.     set    0,offset(ix)        ; DD CB 55 C6
  794.     set    0,offset(iy)        ; FD CB 55 C6
  795.     set    0,a            ; CB C7
  796.     set    0,b            ; CB C0
  797.     set    0,c            ; CB C1
  798.     set    0,d            ; CB C2
  799.     set    0,e            ; CB C3
  800.     set    0,h            ; CB C4
  801.     set    0,l            ; CB C5
  802.     set    1,(hl)            ; CB CE
  803.     set    1,offset(ix)        ; DD CB 55 CE
  804.     set    1,offset(iy)        ; FD CB 55 CE
  805.     set    1,a            ; CB CF
  806.     set    1,b            ; CB C8
  807.     set    1,c            ; CB C9
  808.     set    1,d            ; CB CA
  809.     set    1,e            ; CB CB
  810.     set    1,h            ; CB CC
  811.     set    1,l            ; CB CD
  812.     set    2,(hl)            ; CB D6
  813.     set    2,offset(ix)        ; DD CB 55 D6
  814.     set    2,offset(iy)        ; FD CB 55 D6
  815.     set    2,a            ; CB D7
  816.     set    2,b            ; CB D0
  817.     set    2,c            ; CB D1
  818.     set    2,d            ; CB D2
  819.     set    2,e            ; CB D3
  820.     set    2,h            ; CB D4
  821.     set    2,l            ; CB D5
  822.     set    3,(hl)            ; CB DE
  823.     set    3,offset(ix)        ; DD CB 55 DE
  824.     set    3,offset(iy)        ; FD CB 55 DE
  825.     set    3,a            ; CB DF
  826.     set    3,b            ; CB D8
  827.     set    3,c            ; CB D9
  828.     set    3,d            ; CB DA
  829.     set    3,e            ; CB DB
  830.     set    3,h            ; CB DC
  831.     set    3,l            ; CB DD
  832.     set    4,(hl)            ; CB E6
  833.     set    4,offset(ix)        ; DD CB 55 E6
  834.     set    4,offset(iy)        ; FD CB 55 E6
  835.     set    4,a            ; CB E7
  836.     set    4,b            ; CB E0
  837.     set    4,c            ; CB E1
  838.     set    4,d            ; CB E2
  839.     set    4,e            ; CB E3
  840.     set    4,h            ; CB E4
  841.     set    4,l            ; CB E5
  842.     set    5,(hl)            ; CB EE
  843.     set    5,offset(ix)        ; DD CB 55 EE
  844.     set    5,offset(iy)        ; FD CB 55 EE
  845.     set    5,a            ; CB EF
  846.     set    5,b            ; CB E8
  847.     set    5,c            ; CB E9
  848.     set    5,d            ; CB EA
  849.     set    5,e            ; CB EB
  850.     set    5,h            ; CB EC
  851.     set    5,l            ; CB ED
  852.     set    6,(hl)            ; CB F6
  853.     set    6,offset(ix)        ; DD CB 55 F6
  854.     set    6,offset(iy)        ; FD CB 55 F6
  855.     set    6,a            ; CB F7
  856.     set    6,b            ; CB F0
  857.     set    6,c            ; CB F1
  858.     set    6,d            ; CB F2
  859.     set    6,e            ; CB F3
  860.     set    6,h            ; CB F4
  861.     set    6,l            ; CB F5
  862.     set    7,(hl)            ; CB FE
  863.     set    7,offset(ix)        ; DD CB 55 FE
  864.     set    7,offset(iy)        ; FD CB 55 FE
  865.     set    7,a            ; CB FF
  866.     set    7,b            ; CB F8
  867.     set    7,c            ; CB F9
  868.     set    7,d            ; CB FA
  869.     set    7,e            ; CB FB
  870.     set    7,h            ; CB FC
  871.     set    7,l            ; CB FD
  872.     ;***********************************************************
  873.     ;shift operand left arithmetic
  874.     sla    a,(hl)            ; CB 26
  875.     sla    a,offset(ix)        ; DD CB 55 26
  876.     sla    a,offset(iy)        ; FD CB 55 26
  877.     sla    a,a            ; CB 27
  878.     sla    a,b            ; CB 20
  879.     sla    a,c            ; CB 21
  880.     sla    a,d            ; CB 22
  881.     sla    a,e            ; CB 23
  882.     sla    a,h            ; CB 24
  883.     sla    a,l            ; CB 25
  884.     ;***********************************************************
  885.     ;shift operand right arithmetic
  886.     sra    a,(hl)            ; CB 2E
  887.     sra    a,offset(ix)        ; DD CB 55 2E
  888.     sra    a,offset(iy)        ; FD CB 55 2E
  889.     sra    a,a            ; CB 2F
  890.     sra    a,b            ; CB 28
  891.     sra    a,c            ; CB 29
  892.     sra    a,d            ; CB 2A
  893.     sra    a,e            ; CB 2B
  894.     sra    a,h            ; CB 2C
  895.     sra    a,l            ; CB 2D
  896.     ;***********************************************************
  897.     ;shift operand right logical
  898.     srl    a,(hl)            ; CB 3E
  899.     srl    a,offset(ix)        ; DD CB 55 3E
  900.     srl    a,offset(iy)        ; FD CB 55 3E
  901.     srl    a,a            ; CB 3F
  902.     srl    a,b            ; CB 38
  903.     srl    a,c            ; CB 39
  904.     srl    a,d            ; CB 3A
  905.     srl    a,e            ; CB 3B
  906.     srl    a,h            ; CB 3C
  907.     srl    a,l            ; CB 3D
  908.     ;***********************************************************
  909.     ;subtract operand from 'a'
  910.     sub    a,(hl)            ; CB 96
  911.     sub    a,offset(ix)        ; DD CB 55 96
  912.     sub    a,offset(iy)        ; FD CB 55 96
  913.     sub    a,a            ; CB 97
  914.     sub    a,b            ; CB 90
  915.     sub    a,c            ; CB 91
  916.     sub    a,d            ; CB 92
  917.     sub    a,e            ; CB 93
  918.     sub    a,h            ; CB 94
  919.     sub    a,l            ; CB 95
  920.     sub    a,#n            ; D6 20
  921.     ;***********************************************************
  922.     ;logical 'xor' operand with 'a'
  923.     xor    a,(hl)            ; AE
  924.     xor    a,offset(ix)        ; DD AE 55
  925.     xor    a,offset(iy)        ; FD AE 55
  926.     xor    a,a            ; AF
  927.     xor    a,b            ; A8
  928.     xor    a,c            ; A9
  929.     xor    a,d            ; AA
  930.     xor    a,e            ; AB
  931.     xor    a,h            ; AC
  932.     xor    a,l            ; AD
  933.     xor    a,#n            ; EE 20
  934.  
  935.     .page
  936.     ;***********************************************************
  937.     ; Hitachi HD64180 Codes
  938.     ;***********************************************************
  939.  
  940.     .hd64
  941.  
  942.     ;***********************************************************
  943.     ;load register with input from port (n)
  944.     in0    a,(n)            ; ED 38 20
  945.     in0    b,(n)            ; ED 00 20
  946.     in0    c,(n)            ; ED 08 20
  947.     in0    d,(n)            ; ED 10 20
  948.     in0    e,(n)            ; ED 18 20
  949.     in0    h,(n)            ; ED 20 20
  950.     in0    l,(n)            ; ED 28 20
  951.     ;***********************************************************
  952.     ;multiplication of each half
  953.     ;of the specified register pair
  954.     ;with the 16-bit result going to
  955.     ;the specified register pair
  956.     mlt    bc            ; ED 4C
  957.     mlt    de            ; ED 5C
  958.     mlt    hl            ; ED 6C
  959.     mlt    sp            ; ED 7C
  960.     ;***********************************************************
  961.     ;load output port (c) with
  962.     ;location (hl),
  963.     ;decrement hl and b
  964.     ;decrement c
  965.     otdm                ; ED 8B
  966.     ;***********************************************************
  967.     ;load output port (c) with
  968.     ;location (hl),
  969.     ;decrement hl and c
  970.     ;decrement b
  971.     ;repeat until b = 0
  972.     otdmr                ; ED 9B
  973.     ;***********************************************************
  974.     ;load output port (c) with
  975.     ;location (hl),
  976.     ;increment hl and b
  977.     ;decrement c
  978.     otim                ; ED 83
  979.     ;***********************************************************
  980.     ;load output port (c) with
  981.     ;location (hl),
  982.     ;increment hl and c
  983.     ;decrement b
  984.     ;repeat until b = 0
  985.     otimr                ; ED 93
  986.     ;***********************************************************
  987.     ;load output port (n) from register
  988.     out0    (n),a            ; ED 39 20
  989.     out0    (n),b            ; ED 01 20
  990.     out0    (n),c            ; ED 09 20
  991.     out0    (n),d            ; ED 11 20
  992.     out0    (n),e            ; ED 19 20
  993.     out0    (n),h            ; ED 21 20
  994.     out0    (n),l            ; ED 29 20
  995.     ;***********************************************************
  996.     ;enter sleep mode
  997.     slp                ; ED 76
  998.     ;***********************************************************
  999.     ;non-destructive'and' with accumulator and specified operand
  1000.     tst    a            ; ED 3C
  1001.     tst    b            ; ED 04
  1002.     tst    c            ; ED 0C
  1003.     tst    d            ; ED 14
  1004.     tst    e            ; ED 1C
  1005.     tst    h            ; ED 24
  1006.     tst    l            ; ED 2C
  1007.     tst    #n            ; ED 64 20
  1008.     tst    (hl)            ; ED 34
  1009.     ;***********************************************************
  1010.     ;non-destructive 'and' of n and the contents of port (c)
  1011.     tstio    #n            ; ED 74 20
  1012.     ;***********************************************************
  1013.  
  1014.